<?php
define('PAGE_NEED_PRI','UPLOAD_FILE');
if(isset($_REQUEST[session_name()]))
	$_COOKIE[session_name()] = $_REQUEST[session_name()];
session_start();
include_once("main.php");
include_once("../inc/JSON.php");
include_once("blog-main-edit-function.php");

// JQuery File Upload Plugin v1.4.1 by RonnieSan - (C)2009 Ronnie Garcia
if (!empty($_FILES)) {


	$tempFile = $_FILES['Filedata']['tmp_name'];
	$file_type = substr($_FILES['Filedata']['name'], strrpos($_FILES['Filedata']['name'], "."));
	$targetPath = dirname(dirname(__FILE__)).'/flash/';
	//$targetPath = '/Library/WebServer/Documents/bios/upfiles/';
	$fileName = $_REQUEST['savename'];
	$targetFile =  str_replace('//','/',$targetPath) . $fileName ;

	
	move_uploaded_file($tempFile,$targetFile);
	chmod($targetFile,0666);
	echo "ok";
}
?>